package org.hcyspartnoc.luoxin.controller.searchtopic;

import jakarta.validation.Valid;
import org.hcyspartnoc.luoxin.common.core.AjaxResult;
import org.hcyspartnoc.luoxin.common.core.annotation.Log;
import org.hcyspartnoc.luoxin.common.core.annotation.PreAuthorize;
import org.hcyspartnoc.luoxin.common.core.enums.BusinessType;
import org.hcyspartnoc.luoxin.common.exception.common.CommonUtilsException;
import org.hcyspartnoc.luoxin.common.exception.searchtopic.CommentException;
import org.hcyspartnoc.luoxin.common.exception.searchtopic.TopicException;
import org.hcyspartnoc.luoxin.pojo.dto.searchtopic.CommentDto;
import org.hcyspartnoc.luoxin.pojo.po.searchtopic.CommentPo;
import org.hcyspartnoc.luoxin.pojo.vo.searchtopic.TopicVO;
import org.hcyspartnoc.luoxin.service.searchtopic.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/question/comment")
public class CommentController {

    @Autowired
    CommentService commentService;

    @Log(title = "题目·评论·添加", businessType = BusinessType.INSERT)
    @PreAuthorize(auth = "question:comment:create", descr = "添加题目评论")
    @PostMapping("/create")
    public AjaxResult handCreateQuestion(@RequestBody CommentDto commentDto) throws CommentException{
        CommentPo commentPo = commentService.create(commentDto);
        return AjaxResult.success(commentPo);
    }


}
